<html>
<head>
<title>FILES</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<style>
body{font-family: Arial, Helvetica, sans-serif;font-size:11;;}
td{font-family: Arial, Helvetica, sans-serif;font-size:11;;}

.top {
	border-top-width: 1px;
	border-right-width: 1px;
	border-bottom-width: 1px;
	border-left-width: 1px;
	border-top-style: solid;
	border-right-style: solid;
	border-bottom-style: solid;
	border-left-style: solid;
	border-top-color: #FFFFFF;
	border-right-color: #999999;
	border-bottom-color: #999999;
	border-left-color: #FFFFFF;
	background-color: #CCCCCC;
}
.item {
	font-size: 12px;
	font-style: normal;
	font-weight: normal;
	border-right-width: 1px;
	border-bottom-width: 1px;
	border-right-style: solid;
	border-bottom-style: solid;
	border-left-style: none;
	border-right-color: #CCCCCC;
	border-bottom-color: #CCCCCC;
	background-color: #FFFFFF;
	border-top-style: none;
}
</style>
<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" >
<?php 
Function get_Extension($m_FileName){
	$path_parts = pathinfo($m_FileName);
		if ($path_parts["extension"]) {
			$m_Extension = strtolower($path_parts["extension"]);
			if (file_exists("Images/App/16x16/".$m_Extension.".gif")) {
				return(strtoupper($m_Extension));
			} else {
				return "UNKNOWN";
			}
		} else { return "UNKNOWN"; }
}

Function get_Files($m_Dir) {	
	if ($handle = opendir($m_Dir)) {	
		while (false !== ($file = readdir($handle))) { 
    			if(!is_dir($m_Dir.$file) && substr($file,O,1) != "."){				
					$m_Files[]=$file;
				}
		}
    closedir($handle); 
	}
return $m_Files;
}
function showFiles($m_Files,$m_Dir){
echo "<table cellpadding='0' cellspacing='0' border='0' width=\"100%\">";
echo "<tr><td class=\"top\" valign='top' colspan=\"2\">&nbsp;&nbsp;Name</td><td class=\"top\" align=\"right\" width=\"100\">&nbsp;Size&nbsp;&nbsp;</td><td class=\"top\" width=\"100\">&nbsp;&nbsp;Type</td><td class=\"top\" width=\"100\">&nbsp;&nbsp;Changed</td><td class=\"top\" width=\"30%\">&nbsp;</td></tr>";
echo "<tr><td colspan=\"3\" height=\"2\"></td></tr>";

if(count($m_Files) != 0){
	foreach ($m_Files as $m_FileName) {
   		$m_File_Count++;
		echo "<tr class=\"item\" onmouseover='showOver(this);' onmouseout='showOut(this)' onclick='parent.mainFrame.location.href=\"download.php?fileName=".$m_Dir.$m_FileName."\"'><td width=\"20\" align=\"center\" height=\"16\"><img src=\"Images/App/16x16/".strtolower(get_Extension($m_FileName)).".gif\"</td><td valign='top'>$m_FileName</td><td align=\"right\">".ceil((filesize($m_Dir.$m_FileName)/1024))."&nbsp;kb&nbsp;&nbsp;</td><td>&nbsp;&nbsp;".get_Extension($m_FileName)."</td><td>&nbsp;&nbsp;".date("d/m/Y H:i",filemtime($m_Dir.$m_FileName))."&nbsp;</td><td>&nbsp;</td></tr>";
	}
}
echo "</table>";
}

if(isset($_GET['root'])){showFiles(get_Files($_GET['root']),$_GET['root']);}
?>
</body>
</html>
<script>
ie=(document.all);
function showOver(obj){
	obj.style.cursor=(ie)?'hand':'pointer';
	obj.style.backgroundColor='#0B256B';
	obj.style.color='#FFFFFF';
}
function showOut(obj){
	obj.style.color='#000000';
	obj.style.backgroundColor='#FFFFFF';
}
</script>